<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<form class="layui-form" lay-filter="userForm" id="add_user_form" action="" style="padding:15px 10px;">
    <input type="hidden" name="userid">
    <div class="layui-form-item">
        <label class="layui-form-label">用户名</label>
        <div class="layui-input-block">
            <input type="text" name="username" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">密码</label>
        <div class="layui-input-block">
            <input type="password" name="password" required lay-verify="required" placeholder="请输入密码" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">登陆名</label>
        <div class="layui-input-block">
            <input type="text" name="loginname" required  lay-verify="required" placeholder="请输入标题" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">性别</label>
        <div class="layui-input-block">
            <input type="radio" name="sex" value="1" title="男">
            <input type="radio" name="sex" value="2" title="女" checked>
        </div>

    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">生日</label>
        <div class="layui-input-block">
            <input type="date" name="birthdate" required  lay-verify="required" placeholder="选择" autocomplete="off" class="layui-input">
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">创建时间</label>
        <div class="layui-input-block">
            <input type="date" name="createtime" required  lay-verify="required" placeholder="选择" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">科目</label>
        <div class="layui-input-block">
            <select name="id" id="de_add">
                <option value="">请选择</option>

            </select>
        </div>
    </div>
    <div class="layui-form-item">
        <label class="layui-form-label">头像</label>
        <div class="layui-input-block">
            <input type="file" name="Mage" required  lay-verify="required" placeholder="选择" autocomplete="off" class="layui-input">
        </div>
    </div>

    <div class="layui-form-item">
        <label class="layui-form-label">用户角色</label>
        <div class="layui-input-block" >
            <select name="roleids" id="roles_add" xm-select="roles2" xm-select-direction="down">
                <option value="-1">请选择</option>
            </select>
        </div>
    </div>
    <script>
        layui.form.render();
        $.get("http://localhost:8888/role/search",function(data){
            $.each(data,function(){
                var opt = $("<option></option>").appendTo("#roles_add");
                opt.text(this.roleName).val(this.roleid);
            });
            layui.formSelects.render()
        });
        $.get("http://localhost:8888/Department/search",function(data){
            $.each(data,function(){
                var opt = $("<option></option>").appendTo("#de_add");
                opt.text(this.deName).val(this.id);
            });
            layui.form.render();
        });
    </script>
</form>
</body>
</html>